package com.guangzhi.weijianzhi.adapter;

import com.guangzhi.weijianzhi.R;
import com.guangzhi.weijianzhi.entity.MainHotEntity;
import com.guangzhi.weijianzhi.entity.MainHotTextEntity;

import android.content.Context;
import android.content.Entity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class MainHotAdapter extends SimpleBaseAdapter<MainHotTextEntity> {

	public MainHotAdapter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	@Override
	public int getItemResource() {
		// TODO Auto-generated method stub
		return R.layout.tz_main_hot_layout;
	}

	@Override
	public View getItemView(int position, View convertView,
			com.guangzhi.weijianzhi.adapter.SimpleBaseAdapter.ViewHolder holder) {
		// TODO Auto-generated method stub
		MainHotTextEntity mEntity = getDatas().get(position);
		TextView main_title = (TextView) holder.getView(R.id.main_title);
		main_title.setText(mEntity.title);
		
		TextView main_address = (TextView) holder.getView(R.id.main_address);
		main_address.setText(mEntity.areaString);
		
		TextView main_unitString = (TextView) holder.getView(R.id.main_unitString);
		main_unitString.setText(mEntity.unitString);
		
		TextView main_applynum = (TextView) holder.getView(R.id.main_applynum);
		main_applynum.setText(mEntity.applyNum+"人已报名");
		
		TextView main_time = (TextView) holder.getView(R.id.main_time);
		main_time.setText(mEntity.work_start_time);
		
		ImageView image = (ImageView) holder.getView(R.id.select_service);
		String sort_mark = mEntity.sort_mark;
		if("1".equals(sort_mark)){
			image.setImageResource(R.drawable.gz_income_push);
		}else if("2".equals(sort_mark)){
			image.setImageResource(R.drawable.gz_income_ding);
		}else if("3".equals(sort_mark)){
			//image.setImageResource(R.drawable.quanguo);待定
		}
		
		
		return convertView;
	}

}
